//
//  ZJRootViewController.m
//  PersonalHospital
//
//  Created by qianfeng on 15/12/11.
//  Copyright (c) 2015年 QianFeng. All rights reserved.
//

#import "ZJRootViewController.h"

@interface ZJRootViewController ()


@end

@implementation ZJRootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addTableView];
    
    [self loadData];
}


-(void)loadData{
    NSString * path=@"";
    
    [self loadDataWithPath:path];
}

-(void)addTableView{
    [self.view addSubview:self.tableView];
}


-(void)loadDataWithPath:(NSString *)path{
    
    [self.manager POST:path parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
 
        [self pastDataWith:responseObject];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

    }];
}


-(void)pastDataWith:(id)responseObject{
    

}

-(NSMutableArray *)dataSource{
    if (_dataSource==nil) {
        _dataSource=[[NSMutableArray alloc]init];
    }
    return _dataSource;
}


-(UITableView *)tableView{
    if (_tableView==nil) {
        _tableView=[[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds];
        _tableView.dataSource=self;
        _tableView.delegate=self;
    }
    return _tableView;
}


-(AFHTTPRequestOperationManager *)manager{
    if (_manager==nil) {
        _manager=[AFHTTPRequestOperationManager manager];
    }
    _manager.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"text/html",@"application/json", nil];
    return _manager;
}



-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    return cell;
}













@end
